package cn.bx.bid.service;

import cn.bx.bid.dao.ProfessorDao;
import cn.bx.bid.entity.Page;
import cn.bx.bid.entity.Professor;
import cn.bx.bid.entity.Project;
import cn.bx.bid.entity.WorkHistory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

//M V C
@Service
//@Scope("prototype")
public class ProfessorService {
	public static final int PAGE_SIZE = Page.PAGE_SIZE;

	@Resource
	private ProfessorDao professorDao;

	public Page<Professor> paging(int pageNo, int limit, String name, String tele, String id) {

			List<Professor> list = professorDao.search(pageNo, limit, name, tele, id);
			int total = professorDao.searchTotal(name, tele, id);
			Page<Professor> p = new Page<Professor>(total, limit, list);
			return p;


	}

	public Professor get(long id) {


			 Professor p = professorDao.get(id);
			return p;

	}

    public int delHis(long id, long hisid) {

				int p = professorDao.delHis(id,hisid);
				return p;


    }

	public int addHistory(WorkHistory w) {

			int p = professorDao.addHistory(w);
			return p;

	}
	public List<Project>  findProjs(long  profid) {

			List<Project> p = professorDao.findProjs(profid);
			return p;

	}
	public int addprofessor(Professor p){
		return professorDao.addprofessor(p);
	}

}
